#include <cstdio>
#include <memory.h>
#include <algorithm>
using namespace std;

int F[505];
int w[15];

int main() {
	for (int i = 1; i <= 10; ++i) {
		scanf("%d", w + i);
	}

	int d;
	scanf("%d", &d);
	memset(F, 0x7f, sizeof(F));
	F[0] = 0;

	for (int i = 1; i <= d; ++i) {
		for (int r = 1; r <= min(10, i); ++r) {
			F[i] = min(F[i], F[i - r] + w[r]);
		}
	}

	printf("%d\n", F[d]);
	return 0;
}